package com.googlecode.simplexer.validator.implementation;

public class NumericVerifier extends AbstractVerifier {

	public boolean validate(char chr) throws UnsupportedOperationException {
		return (chr >= '0' && chr <= '9');
	}

	public boolean validate(String string) throws UnsupportedOperationException {
		int dotCount = 0;

		for (char chr : string.toCharArray()) {
			if (chr == '.') {
				if (dotCount == 1) {
					return false;
				}
				dotCount = 1;
			}
			if (!validate(chr)) {
				return false;
			}
		}
		return true;
	}
}
